package aapilast3;

import java.lang.reflect.Method;

public class ReflectDemo5 {
    public static void main(String[] args)throws Exception {
        Person p = new Person("张三", 20);
        p.sayHello();

        Class<?> cls = Class.forName("aapilast3.Person");
        Object obj = cls.newInstance();
        Method method = cls.getMethod("sayHello");
        method.invoke(obj);

    }
}
